package com.heu.picture.reposity;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heu.picture.entity.UserPO;
import com.heu.picture.mapper.UserMapper;
import org.springframework.stereotype.Repository;

@Repository
public class UserRepository extends ServiceImpl<UserMapper, UserPO> {

    public UserPO getUserByUserAccount(String userAccount) {
        LambdaQueryChainWrapper<UserPO> wrapper = lambdaQuery().eq(UserPO::getUserAccount, userAccount);
        return wrapper.one();
    }

    public UserPO getuserByUsername(String username, String userPassword) {
        return lambdaQuery().eq(UserPO::getUserAccount, username).eq(UserPO::getUserPassword, userPassword).one();
    }
}
